<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models\Sundry;

use Carbon\Carbon;
use App\Models\Eloquent;
use App\Models\Meimei\Traits\SignOssUrlTrait;
use App\Models\Meimei\Traits\ExplodeTrait;

/**
 * Class QtpNotepad
 *
 * @property int $id
 * @property string $title
 * @property string $note
 * @property string $tags
 * @property int $admin_id
 * @property int $status
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 *
 * @package App\Models
 */
class Notepad extends Eloquent
{
    use ExplodeTrait;
    use SignOssUrlTrait;
    protected $explode = ['tags'];

	protected $table = 'notepads';

	protected $casts = [
		'admin_id' => 'int',
		'status' => 'int'
	];

	protected $fillable = [
		'title',
		'note',
		'tags',
		'admin_id',
		'status'
	];

    public static $fillables = [
        'title' => '记事标题',
        'note' => '记事内容',
        'tags' => '标记标签',
        'admin_id' => '书写人.ID',
        'status' => '处理状态',
    ];

    const STATUS_INIT = 1;
    const STATUS_DONE = 2;
    public static $status_mpas = [
        self::STATUS_INIT => '待处理',
        self::STATUS_DONE => '已处理',
    ];

    public function label()
    {
        $this->status_label = self::$status_mpas[$this->status] ?? '';
        return $this;
    }
}
